#include "vmlinux.h"
#include <bpf/bpf_helpers.h>

struct {
    __uint(type, BPF_MAP_TYPE_HASH);
    __uint(max_entries, 1);
    __type(key, int);
    __type(value, unsigned long);
} count SEC(".maps");

SEC("xdp")
int xdp_count(struct xdp_md *ctx) {
    int zero = 0;
    unsigned long *c;

    c = bpf_map_lookup_elem(&count, &zero);
    if (c)
        (*c)++;

    return XDP_PASS;
}

char __license[] SEC("license") = "GPLv3";
